import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:get/get.dart';
import 'package:wk_robot2/app/modules/home/controllers/home_controller.dart';

import '../../../blt/BltManager.dart';
import '../../../routes/app_pages.dart';
import '../../../style/app_colors.dart';
import '../controllers/bind_sucess_controller.dart';

class BindSucessView extends GetView<BindSucessController> {
  const BindSucessView({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
          icon: Image.asset('assets/images/ic_back2.png',width: 48.w,height: 48.h),
          onPressed: () {
            Get.back();
          },
          tooltip: MaterialLocalizations.of(context).backButtonTooltip, // 可选：设置工具提示
        ),
      ),
      body: Center(
        child: Column(
          children: [
            SizedBox(height: 186.h),
            Image.asset('assets/images/binding_success_img.webp',width: 270.w, height: 270.h),
            SizedBox(height: 22.h),
            Text('绑定成功！',style: TextStyle(color: AppColors.Page_Title_Color,fontSize: 36.sp),),
            SizedBox(height: 22.h),
            Text('可以通过"悟空悟空"唤醒机器人和它聊天啦',style: TextStyle(color: AppColors.Sub_Title_Color,fontSize: 28.sp)),
            Row(
              children: [
                 Container(
                   padding: EdgeInsets.only(left: 110.w),

                   child:  Text('示例:',style: TextStyle(color: AppColors.Sub_Title_Color,fontSize: 28.sp)),
                 )
              ],
            ),
            SizedBox(height: 50.h),
            Row(
              children: [
                Container(
                  margin: EdgeInsets.only(left: 100.w),
                  padding: EdgeInsets.only(left: 30.w,top: 15.h,bottom: 15.h,right: 40.w),
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(40),
                      color: Colors.white,
                      boxShadow: [
                        BoxShadow(
                          color: Colors.black.withOpacity(0.1), // 阴影颜色
                          spreadRadius: 2.w, // 阴影扩展半径
                          blurRadius: 7.w, // 阴影模糊半径
                          offset: Offset(0, 3), // 阴影偏移量（水平，垂直）
                        ),
                      ]
                  ),
                  child: Text('悟空悟空，为什么先看到闪电再听到雷声?',style: TextStyle(fontSize: 28.sp,color: AppColors.Page_Title_Color)),
                ),
              ],
            ),
            SizedBox(height: 20.h,),
            Row(
              children: [
                Container(
                  margin: EdgeInsets.only(left: 100.w),
                  padding: EdgeInsets.only(left: 30.w,top: 15.h,bottom: 15.h,right: 40.w),
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(40),
                      color: Colors.white,
                      boxShadow: [
                        BoxShadow(
                          color: Colors.black.withOpacity(0.1), // 阴影颜色
                          spreadRadius: 2.w, // 阴影扩展半径
                          blurRadius: 7.w, // 阴影模糊半径
                          offset: Offset(0, 3), // 阴影偏移量（水平，垂直）
                        ),
                      ]
                  ),
                  child: Text('悟空悟空，跳个舞',style: TextStyle(fontSize: 28.sp,color: AppColors.Page_Title_Color)),
                ),
              ],
            ),
            SizedBox(height: 20.h,),
            Row(
              children: [
                Container(
                  margin: EdgeInsets.only(left: 100.w),
                  padding: EdgeInsets.only(left: 30.w,top: 15.h,bottom: 15.h,right: 40.w),
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(40),
                      color: Colors.white,
                      boxShadow: [
                        BoxShadow(
                          color: Colors.black.withOpacity(0.1), // 阴影颜色
                          spreadRadius: 2.w, // 阴影扩展半径
                          blurRadius: 7.w, // 阴影模糊半径
                          offset: Offset(0, 3), // 阴影偏移量（水平，垂直）
                        ),
                      ]
                  ),
                  child: Text('悟空悟空，How are you?',style: TextStyle(fontSize: 28.sp,color: AppColors.Page_Title_Color)),
                ),
              ],
            ),
            SizedBox(height: 316.h),
            Container(
              width: 594.w,
              child: ElevatedButton(onPressed: () {
                //如果有正在连接得机器,给断开.
                BltManager.instance.disConnectDevice();

                HomeController homecontroller =  GetInstance().find<HomeController>();
                homecontroller.onTap(0);
                Get.offAllNamed(Routes.HOME);

              }, child: Text('进入首页')),
            )

          ],
        ),
      ),
    );
  }
}
